package tienmanh.gs.goldminer.util;

import tienmanh.gs.goldminer.manager.ResourcesManager;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class Level {
	public static String filename = "level";
	public static SharedPreferences sp;
	public static Editor edit;
	
	public static void init(){
		sp = ResourcesManager.getInstance().activity.getSharedPreferences(filename,0);
		edit = sp.edit();
	}
	public static void writeGoldSP(int value){
	    edit.putInt("level", value);
	    edit.commit();
	}
	public static int readEGoldSP(){
	    return sp.getInt("level", 1);
	}
	
	public static void writeLevel(int value){
	    edit.putInt("levelall", value);
	    edit.commit();
	}
	public static int readLevel(){
	    return sp.getInt("levelall", 1);
	}
	
	public static void writeStateRun(boolean run){
	    edit.putBoolean("run", run);
	    edit.commit();
	}
	public static boolean readStateRun(){
	    return sp.getBoolean("run", false);
	}
}
